<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <!-- html 要用服务器形式打开 -->
        <input type="file" name="file" id="upload" />
        <button>上传文件</button>
        <button id="btn">导出</button>
        <script src="https://cdn.bootcdn.net/ajax/libs/axios/0.27.2/axios.js"></script>
        <script>
            const param = new FormData();
            const config = {
                headers: { "Content-Type": "multipart/form-data" },
            };
            document.querySelector("#upload").onchange = (e) => {
                e.preventDefault();
                param.append("file", e.target.files[0]);
            };
            document.querySelector("button").onclick = () => {
                axios
                    .post("http://127.0.0.1:3000", param, config)
                    .then((res) => {
                        console.log(res);
                    });
            };
            document.querySelector("#btn").onclick = ()=>{
                window.location.href = 'http://demo.open.renren.io/renren-security-server/sys/log/login/export?token=be7a84664c55612062d7029c360f62f1&creatorName=&status=0'
            }
        </script>
    </body>
</html>
